package com.green.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.green.entity.MyUser;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

@Slf4j
public class UserReadListener implements ReadListener<MyUser> {

    @Getter
    private List<MyUser> data;

    public UserReadListener() {
        data = new ArrayList<>();
    }

    @Override
    public void invoke(MyUser myUser, AnalysisContext analysisContext) {
        data.add(myUser);

    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        log.info("所有数据解析完成！");
    }
}
